<?php
namespace app\modules\weixin\controllers;


use \app\common\components\BaseWebController;
use \app\common\services\UtilService;
use \app\common\services\UrlService;
use \app\common\services\weixin\RequestServices;
use \app\common\components\HttpCurl;

class MenuController extends BaseWebController
{
	public function actionSet(){
		$access_token=RequestServices::getAccessToken();
		// echo $access_token;
		// exit;
		
		$menu=[
			"button"=>[
				[
					"name"=>"商城",
					"type"=>"view",
					"url"=>UrlService::buildMUrl("/product/index"),
				],
				[
					"name"=>"我",
					"type"=>"view",
					"url"=>UrlService::buildMUrl("/user/index"),
				],
			],
		];
		// var_dump(json_encode($menu,JSON_UNESCAPED_UNICODE));
		// exit;
		if($access_token){
			$url='menu/create?access_token='.$access_token;
			$ret=RequestServices::send($url,json_encode($menu,JSON_UNESCAPED_UNICODE),"POST");
			var_dump($ret);
		}
		
	}
}
?>